<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>    
<%@ include file="/taglibs.jsp"%>
<script type="text/javascript" charset="UTF-8" src="../js/jquery-ui-1.7.2.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/jquery-ui-1.7.2.custom.css"/>
<!-- 验证 -->
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/formValidator_min.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/formValidator.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/formValidatorRegex.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/jquery.alphanumeric.js"></script>
<!-- 地址选单 -->
<script type="text/javascript" charset="UTF-8" src="/genJS/yaodian_zipCodCode.js"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/jquery.cascade.ext.js"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/jquery.cascade.js"></script>
<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/jquery.templating.js"></script>

<script type="text/javascript" charset="UTF-8" src="<%=application.getContextPath() %>/js/yaodian100.common.js"></script>
<yaodian100:checkPermission permissions="GROUP_A-30-400-000,GROUP_C.01,GROUP_C.01">
<script type="text/javascript">
$().ready(function(){	
	//其他的支付方式不显示当前的支付方式。（如当前的支付方式为网上支付，則此处不显示网上支付选项）
	if( ${order.paymentTp} == '10'){
		swithDis($("#paytype10"),true,"radio");		
		$("#paytype10").attr("checked",false);
		//$("#showMessage").hide();
	}
	if(${order.paymentTp} == '20'){
		swithDis($("#paytype20"),true,"radio");		
		$("#paytype20").attr("checked",false);
		//$("#showMessage").hide();
	}
	if( ${order.paymentTp} == '30' || ${order.paymentTp} == '60'){
		
		swithDis($("#paytype10"),false,"radio");
		$("#paytype10").attr("checked",false);
		swithDis($("#paytype20"),false,"radio");
		$("#paytype20").attr("checked",false);
		swithDis($("#paytype40"),false,"radio");
		$("#paytype40").attr("checked",false);
		swithDis($("#paytype50"),false,"radio");
		$("#paytype50").attr("checked",false);
		swithDis($("#paytype70"),false,"radio");
		$("#paytype70").attr("checked",false);
		if (${order.paymentTp} == '30'){
			swithDis($("#paytypeCash"),true,"radio");
			$("#paytypeCash").attr("checked",false);
		}
		if (${order.paymentTp} == '60'){
			swithDis($("#paytypePos"),true,"radio");
			$("#paytypePos").attr("checked",false);
		}
		
	}
	if( ${order.paymentTp} == '40'){
		swithDis($("#paytype40"),true,"radio");
		$("#paytype40").attr("checked",false);
		
	}
	
	if( ${order.paymentTp} == '50'){
		swithDis($("#paytype50"),true,"radio");
		$("#paytype50").attr("checked",false);

		swithDis($("#paytype30"),false,"radio");
		swithDis($("#paytypeCash"),false,"radio");
		swithDis($("#paytypePos"),false,"radio");
		$("#paytype30").attr("checked",false);
		$("#paytypeCash").attr("checked",false);
		$("#paytypePos").attr("checked",false);
		
	}

	//如账户余额不足支付，则disable该选项；如账户余额足够，则需支付全额的应付总额。
	if(parseFloat(${member.balance.virtualBalance}) < parseFloat(${order.joinMustPay})){
		swithDis($("#paytype40"),true,"radio");
		$("#paytype40").attr("checked",false);
	}

	//请选择要变更的支付方式alert
	$("#chkPayType").dialog({
		bgiframe: true,
		autoOpen: false,
		height: 200,
		width:400,
		modal: true
	});	
	$("#chkOK").click(function(){
		$("#chkPayType").dialog('close');
	});

	//订单金额超过10000元，不提供货到付款服务
	var totalPrice = parseFloat(${order.totalPrice})-parseFloat(${order.bonus})-parseFloat(${order.coupon})+parseFloat(${order.shipfare})-parseFloat(${order.discount})+parseFloat(${order.codFee});
	if(parseFloat(totalPrice)>10000){
		disableCodPos();
		$("#showOrderPriceLimit").html("(订单金额超过10000元，不提供货到付款服务。");
		$("#displayPOS").hide();
	}

	//如该订单为"门店取货"，则disable「货到付款」选项供选择。
	if(${order.receiverTp} == '30'){
		disableCodPos();
		$("#showOrderPriceLimit").html("(达芙妮门店取货暂不支援");
		$("#displayPOS").hide();
	}
	//如该订单为拆单，则disable「货到付款」选项供选择。
	if('${order.orderId}' != '${order.joinOrders}'){
		disableCodPos();
		$("#showOrderPriceLimit").html("(合并结帐暂不支援");
		$("#displayPOS").hide();
	}
	if('false'=='${showCod}'){
		disableCodPos();
		$("#displayPOS").hide();
	}
	
	//如选择货到付款，则default选择现金选项。
	$('input[id=paytype30]').click(function() {
		$("#paytype30").attr("checked",true);//for ie6
		if ($('input[id=paytypeCash]').is(":checked") == false && $('input[id=paytypePos]').is(":checked") == false){			
			$("#paytypeCash").attr("checked",true);
			$("#paytype30").val("30"); 
			$("#paytype30").attr("checked",true);//for ie6
			$("#paytype10").attr("checked",false);
			$("#paytype20").attr("checked",false);
			$("#paytype40").attr("checked",false);
			$("#paytype50").attr("checked",false);
			$("#paytype70").attr("checked",false);
			$("#paytypePos").attr("checked",false);
		}
	});

	$('input[id=paytypeCash]').click(function() {
		$("#paytype30").attr("checked",true);		
		$("#paytype30").val("30"); 
		$("#paytypeCash").attr("checked",true);
		$("#paytype10").attr("checked",false);
		$("#paytype20").attr("checked",false);
		$("#paytype40").attr("checked",false);
		$("#paytype50").attr("checked",false);
		$("#paytype70").attr("checked",false);
		$("#paytypePos").attr("checked",false);
	});
	$('input[id=paytypePos]').click(function() {
		$("#paytype30").attr("checked",true);
		$("#paytype30").val("60"); 
		$("#paytypePos").attr("checked",true);
		$("#paytype10").attr("checked",false);
		$("#paytype20").attr("checked",false);
		$("#paytype40").attr("checked",false);
		$("#paytype50").attr("checked",false);
		$("#paytype70").attr("checked",false);
		$("#paytypeCash").attr("checked",false); 
	});

	$('input[id=paytype10]').click(function() {
		$("#paytype30").attr("checked",false);
        unCheckPos();
        $("#paytype10").attr("checked",true);
	});
	$('input[id=paytype20]').click(function() {
		$("#paytype30").attr("checked",false);
        unCheckPos();
        $("#paytype20").attr("checked",true);
	});
	$('input[id=paytype40]').click(function() {
		$("#paytype30").attr("checked",false);
        unCheckPos();
        $("#paytype40").attr("checked",true);
	});

	$('input[id=paytype50]').click(function() {
		$("#paytype30").attr("checked",false);
        unCheckPos();
        $("#paytype50").attr("checked",true);
	});

	$('input[id=paytype70]').click(function() {
		$("#paytype30").attr("checked",false);
        unCheckPos();
        $("#paytype70").attr("checked",true);
	});

	isPos();
	
	//判斷是否使用POS
	function isPos(){
		if('${showPos}'=='N'){
			swithDis($("#paytypePos"),true,"radio");
			//$("#paytypePos").attr("disabled",true); 
			if( ${order.paymentTp} == '30') {
				swithDis($("#paytype30"),true,"radio");
				$("#paytype30").attr("checked",false);
			}
			$("#posMessage").html("<span class='txt-rd'><%=ServerValue.getOrderModiyAddress()%></span>");
		}else{
			$("#posMessage").html("");
		}
	}

	//upcheck POS cash & pos
	function unCheckPos(){
		$("#paytypeCash").attr("checked",false);
		$("#paytypePos").attr("checked",false);	
	}
	
	function disableCodPos(){
		swithDis($("#paytype30"),true,"radio");
		swithDis($("#paytypeCash"),true,"radio");
		swithDis($("#paytypePos"),true,"radio");		
		$("#paytype30").attr("checked",false);
		$("#paytypeCash").attr("checked",false);
		$("#paytypePos").attr("checked",false);
	}

	 $("#paytb").show();
		
	$("#go_next").click(function() {
		if ($('input[name*=paytype]').is(":checked") == false){
			$('#chkPayType').dialog('destroy');
			$('#chkPayType').dialog({
				closeOnEscape: false,
				open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); },
				bgiframe: true,
				width:380,
				modal: true
			});
			return false;
		}else{
			$("#modPayTpForm").submit();
			return false;
		}	
		
	});
	
});
		
</script>
${pu:reqSet('member', pu:get('com.yaodian100.ec.member.entity.Member', order.memberId)) }
<h1>修改支付方式</h1>
<div class="f-link"><a href="view.do?orderId=${order.orderId}">回订单查询页</a></div><br><br>

<table width="100%" border="1" cellspacing="0" cellpadding="0" class="tb-data">
<tr>
  	<td ></td>
    <td class="bg-yl"><b>订单资料</b></td>
  </tr>
  <tr>  	
    <td class="bg-yl">订单编号:</td>
    <td > ${order.orderId}</td>
  </tr>
   <tr>  	
    <td class="bg-yl">会员编号:</td>
    <td >${order.memberId }</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">订购人:</td>
    <td >${order.memberName}</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">订单状态:</td>
    <td >${orderStMenu.options[order.orderSt].name}</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">订购日期:</td>
    <td ><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${order.orderDt}" /></td>
  </tr>  
   <tr>  	
    <td class="bg-yl">付款状态:</td>
    <td >${paymentStMenu.options[order.paymentSt].name}</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">订单来源:</td>
    <td >${order.channel}</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">网站:</td>
    <td >${domainSrc.options[order.domainSrc].name}</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">付款期限:</td>
    <td >
    <c-rt:if test="${order.paymentTp!='30'}">
    <fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${order.deadline}" />
    </c-rt:if>
    </td>
  </tr>
  <tr>  	
    <td class="bg-yl">最后修改人:</td>
    <td >${order.modifyUser}</td>
  </tr>  
   <tr>  	
    <td class="bg-yl">最后修改时间:</td>
    <td ><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${order.modifyDate}" /></td>
  </tr>
  <tr>  	
    <th>当前支付方式:</th>
    <td >${paymentTpMenu.options[order.paymentTp].name}
    	<c-rt:if test="${order.orderId ne order.joinOrders}">
	       <p><strong>合并结帐：</strong>订单 ${order.joinOrders} 将一并变更</p>
	    </c-rt:if>
    </td>
  </tr>  
   <tr>  	
    <th>当前应付总额:</th>
    <td >${order.joinMustPay}</td>
  </tr>
  <tr>
  	<th>变更为其他支付方式:</th>
  	<td>
  	<s:form action="updatePaymentTp.do" id="modPayTpForm" name="modPayTpForm" method="post">
	<input type="hidden" name="orderId" value="${order.orderId}"/>
	  <!-- content start -->
	  <div class="content order-modify">
	    <!-- 我的訂單 --> 
		      <div class="d-show">
		      <div id="showMessage">
		         	<c-rt:if test="${order.joinMustPay >0}">
		                    <table width="80%" border="0" cellspacing="0" cellpadding="0"  id="paytb" style="display:none">
		                    	
		                        <tr>
		                          <td width="20"><input id="paytype40" name="paytype" type="radio" value="40"></td>
		                          <td><p>用账户余额支付订单全额：<strong>￥ ${order.joinMustPay}元</strong> / 目前我的账户余额为 ￥<span id="myVirtualBalance">${member.balance.virtualBalance}</span> 元</p></td>
		                        </tr>
		                        	                         
		                         <tr ${order.paymentTp=='50'?"style='display:none'":""}>
		                          <td width="20"><input id="paytype50" name="paytype" type="radio" value="50"> </td>
		                          <td><strong>网上支付</strong></td>
		                        </tr>
		                        <tr ${order.paymentTp=='50'?"style='display:none'":""}>
		                          <td>&nbsp;</td>
		                          <td><p><strong>第三方支付：</strong></p>
		                                 <p class="sub-bank">银联、财付通、快钱、支付宝</p>
		               					 <p><strong>银行支付：</strong></p>
		               				 	 <p class="sub-bank">工商银行、农业银行、建设银行、交通银行、蒲发银行、招商银行、广发银行</p>
		                         </td>
		                        </tr>
		                        <c-rt:if test="${empty order.tuangouId}">	
		                        <tr ${order.paymentTp=='70'?"style='display:none'":""}>
		                          <td width="20"><input id="paytype70" name="paytype" type="radio" value="70"> </td>
		                          <td><strong>信用卡：单期付款</strong></td>
		                        </tr>
		                        <tr ${order.paymentTp=='20'?"style='display:none'":""}>
		                          <td width="20"><input type="radio" id="paytype20" name="paytype" value="20"></td>
		                          <td><strong>邮局汇款</strong> <span class="txt-gy">(至邮局柜台汇款)</span></td>
		                        </tr>
		                        <tr ${order.paymentTp=='10'?"style='display:none'":""}>
		                          <td width="20"><input id="paytype10" name="paytype" type="radio" value="10"></td>
		                          <td><strong>银行汇款</strong> <span class="txt-gy">(至银行柜台汇款)</span></td>
		                        </tr>		                       
		                        <tr>
		                          <td valign="top"><input id="paytype30" name="paytype" type="radio" value=""></td>
		                          <td><strong>货到付款</strong> <span class="txt-rd"><strong id="showOrderPriceLimit" >(<strong>需加收手续费 ${codFee}元</strong></strong>)</span>
		                            <div id="displayPOS">
				                            <div>
				                              <p>
				                               <input id="paytypeCash" name="paytypecp" type="radio" value="30" />
				                           	     现金 </p>
				                          </div>
				                            <div>
				                              <p>
				                                <input id="paytypePos" name="paytypecp" type="radio" value="60" />
				                                POS机刷卡<strong id="posMessage"></strong></p>
				                          </div>
				                     </div>     
				                          </td>
		                     	</tr>	
		                     	</c-rt:if>                     
		                      
		                      </table>
		                </c-rt:if>  
		                <c-rt:if test="${order.joinMustPay ==0}">
	                		应付总额為￥0.0元，無支付方式
	                 </c-rt:if> 
	             </div>
   
		        <p class="c-f" align="center"><br />
		        <input type="submit" name="submit_button" id="submit_button" value="送出" />
  				<input type="reset" name="button2" id="button2" value="重設" />
		        </p>
		      </div>
		   
	   <!-- 我的訂單 -->
	  </div>
	  <!-- content end --> 
	  </s:form>
  	</td>
  </tr> 
  
</table>
</yaodian100:checkPermission>
<div class="f-link">
	<a href="view.do?orderId=${order.orderId}">回订单查询页</a>
</div>